package cn.jji8.createX.manipulate;

import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerInteractEvent;

import java.util.HashMap;
import java.util.Map;

/**
 * 选择器,用于玩家选择目标点
 * */
public class Selector {
    static final Map<Player, SelectorImplement> selectorimplementMap = new HashMap<>();
    /**
     * 由Monitor调用
     * */
    public static void PlayerInteractEvent(PlayerInteractEvent e){
        SelectorImplement selectorimplement = selectorimplementMap.get(e.getPlayer());
        if(selectorimplement!=null){
            selectorimplement.PlayerInteractEvent(e);
        }
    }
    /**
     * 设置玩家的Selectorimplement
     * */
    public static void setPlayerSelectorimplement(Player player, SelectorImplement selectorimplement){
        selectorimplementMap.put(player,selectorimplement);
    }
    /**
     * 获取玩家的Selectorimplement
     * */
    public static SelectorImplement getPlayerSelectorimplement(Player player){
        return selectorimplementMap.get(player);
    }
}
